﻿using System;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using System.Collections;
using System.Xml;
using System.Threading;
using System.Diagnostics;
using TS_XY_Train_Repaire.SysSetting;
using TS_XY_Train_Repaire.Stuff;
using TS_XY_Train_Repaire.Main_Base;
using TS_XY_Train_Repaire.Main_Base.DigitalMap;
using TS_XY_Train_Repaire.Locomotive.MainBase;
using TS_XY_Train_Repaire.Locomotive.TrainRepair;
using TS_XY_Train_Repaire.Materials;
using TS_XY_Train_Repaire.Materials.Interchange;
using TS_XY_Train_Repaire.Locomotive.Plane;
using TS_XY_Train_Repaire.Locomotive.TrainRepair;
using TS_XY_Train_Repaire.Locomotive.TrainRepair.Work;
using TS_XY_Train_Repaire.Locomotive.TrainRepair.Work.Fittings;
using TS_XY_Train_Repaire.Locomotive.TrainRepair.Work.Datacomplete;
using TS_XY_Train_Repaire.Locomotive.TrainRepair.Work.WorkPub;
using TS_XY_Train_Repaire.Pub.ChartForm;
using TS_XY_Train_Repaire.Locomotive.MainBase.Fittings;
using TS_XY_Train_Repaire.DocMana;
using TS_XY_Train_Repaire.ToolSystem;

namespace TS_XY_Train_Repaire
{
    public partial class TS_Win_Locomotive_MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        private string[] s = new string[1];  
        public static Hashtable htActionItem = new Hashtable();
        public static GetSysSettings _SysSettings = new GetSysSettings();
        public static UserSettings pUserInfoMain = new UserSettings();
        public static string _SkinName = "";
        public string[] _StartArgs;

        public TS_Win_Locomotive_MainForm(string[] args)
        {
            InitializeComponent();
            _StartArgs = args;
        }

        private void TS_Win_Locomotive_MainForm_Load(object sender, EventArgs e)
        {
            ribbon.Minimized = true;
            string strSQL = "";
            this.Text = TS_Win_Class._AppName + TS_Win_Class._Version + TS_Win_Class._BuildTime;
            this.ribbon.Minimized = true;
            init();
            Thread th = new Thread(new ThreadStart(SQL_Test_Link));
            th.Start();
            try
            {
                _SysSettings._GetRailwayBureau = TS_Win_Class.GetSQlFieldValue("select f_funcid from TS_S_T_S_System where f_id=0", "f_funcid");
                _SysSettings._GetRailwayStations = TS_Win_Class.GetSQlFieldValue("select f_funcid from TS_S_T_S_System where f_id=1", "f_funcid");
                _SysSettings._GetWinFormAuth = TS_Win_Class.GetSQlFieldValue("select f_funcid from TS_S_T_S_System where f_id=2", "f_funcid");
            }
            catch
            {
                MessageBox.Show("系统参数载入错误！");
            }

            XmlDocument xmlDoc = new XmlDocument();
            try
            {
                xmlDoc.Load(TS_Win_Class._xml_SysSetting_Filename); //加载XML文档
                XmlNode xmlNode = xmlDoc.SelectSingleNode("//xml_TS_AllInOne//LocalSetting//AutoLogin");//加载是否自动登录节点

                if (xmlNode.InnerText.Trim() == "1")
                {
                    xmlNode = xmlDoc.SelectSingleNode("//xml_TS_AllInOne//AcountData");

                    strSQL = "select top 1 getdate() as F_servertime,*,(select f_name from TS_S_T_P_RailwayStations where f_id=TS_S_T_P_Stuff.f_rsid) as f_rsname,(select f_name from TS_S_T_P_Department where f_id=TS_S_T_P_Stuff.f_depid) as f_depname,(select f_level from TS_S_T_P_Department where f_id=TS_S_T_P_Stuff.f_depid) as f_level,(select f_name from TS_S_T_P_Position where f_id=TS_S_T_P_Stuff.f_posid) as f_posname,(select f_name from TS_S_T_P_RailwayBureau where f_id=TS_S_T_P_Stuff.f_rbid) as f_rbname from TS_S_T_P_Stuff where f_workercode='" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(1).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + "' and f_password='" + xmlNode.ChildNodes.Item(2).InnerText + "' and f_del=0 and f_id=" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(0).InnerText, TS_Win_Class._xml_SysSetting_CompanyName);
                    SqlConnection conn = new SqlConnection(TS_Win_Class.GetSQlConnStr());
                    conn.Open();
                    SqlCommand comm = new SqlCommand(strSQL, conn);
                    SqlDataReader read = comm.ExecuteReader();
                    if (read.HasRows)
                    {
                        read.Read();
                        pUserInfoMain.UserLoginState = true;
                        pUserInfoMain.Username = read["F_name"].ToString().Trim();
                        pUserInfoMain.UserCode = read["f_workercode"].ToString().Trim();
                        if (read["f_level"].ToString().Trim() == ",")
                        {
                            pUserInfoMain.UserDepTopID = read["f_depid"].ToString().Trim();
                        }
                        else
                        {
                            string strtopid = read["f_level"].ToString().Trim().Substring(1);
                            strtopid = strtopid.Substring(0, strtopid.IndexOf(","));
                            pUserInfoMain.UserDepTopID = strtopid;
                        }
                        pUserInfoMain.UserDepIndex = read["f_depid"].ToString().Trim();
                        pUserInfoMain.UserDepName = read["f_depname"].ToString().Trim();
                        pUserInfoMain.UserPosID = read["f_posid"].ToString().Trim();
                        pUserInfoMain.UserPosName = read["f_posname"].ToString().Trim();
                        pUserInfoMain.GuId = read["F_id"].ToString().Trim();
                        pUserInfoMain.UserRSID = read["F_rsid"].ToString().Trim();
                        pUserInfoMain.UserRSName = read["F_rsname"].ToString().Trim();
                        pUserInfoMain.LoginTime = read["F_servertime"].ToString().Trim();
                        pUserInfoMain.UserRBID = read["F_rbid"].ToString().Trim();
                        pUserInfoMain.UserRBName = read["F_rbname"].ToString().Trim();
                        pUserInfoMain.UserDataRankID = read["F_datarank"].ToString().Trim();
                        bsi_B_Left.Caption = "当前用户：" + pUserInfoMain.UserRBName + ">" + pUserInfoMain.UserRSName + ">" + pUserInfoMain.UserDepName + ">" + pUserInfoMain.Username + ">" + pUserInfoMain.UserPosName;
                        if (!TS_Win_Class.WriteAuthorityInXml(pUserInfoMain.GuId, pUserInfoMain.UserDepIndex, pUserInfoMain.UserPosID,_SysSettings._GetWinFormAuth))
                        {
                            MessageBox.Show("系统权限载入错误，可能隐形部分功能的使用！");
                        }
                    }
                    else
                    {
                        pUserInfoMain.UserLoginState = true;
                        pUserInfoMain.Username = "访客";
                        pUserInfoMain.UserCode = "null";
                        pUserInfoMain.UserDepIndex = "null";
                        pUserInfoMain.UserDepName = "访客";
                        pUserInfoMain.UserPosID = "null";
                        pUserInfoMain.UserPosName = "访客";
                        pUserInfoMain.GuId = "null";
                        pUserInfoMain.UserRSID = "null";
                        pUserInfoMain.UserRSName = "访客";
                        pUserInfoMain.LoginTime = "null";
                        pUserInfoMain.UserRBID = "null";
                        pUserInfoMain.UserRBName = "访客";
                        pUserInfoMain.UserDataRankID = "null";
                        TS_Win_Class.DelAuthorityInXml();
                        MessageBox.Show("使用本地账户登录失败，请重新登陆！");
                    }
                    conn.Close();
                }
                else
                {
                    pUserInfoMain.UserLoginState = false;
                    pUserInfoMain.Username = "访客";
                    pUserInfoMain.UserCode = "null";
                    pUserInfoMain.UserDepIndex = "null";
                    pUserInfoMain.UserDepName = "访客";
                    pUserInfoMain.UserPosID = "null";
                    pUserInfoMain.UserPosName = "访客";
                    pUserInfoMain.GuId = "null";
                    pUserInfoMain.UserRSID = "null";
                    pUserInfoMain.UserRSName = "访客";
                    pUserInfoMain.LoginTime = "null";
                    pUserInfoMain.UserRBID = "null";
                    pUserInfoMain.UserRBName = "访客";
                    pUserInfoMain.UserDataRankID = "null";
                    TS_Win_Class.DelAuthorityInXml();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            if (!pUserInfoMain.UserLoginState)
            {
                this.Visible = false;
                LoginForm login = new LoginForm();

                login.Visible = false;
                if (login.ShowDialog() == DialogResult.Cancel)
                {
                    this.Visible = true;
                }
                else
                {
                    this.Visible = true;
                }
                login.Close();
            }
            else
            {
                string item = "Pub_ChartForm_MainForm_FirstPage";
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).Focus();
                        ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Pub_ChartForm_MainForm_FirstPage _LoadForm = new Pub_ChartForm_MainForm_FirstPage();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            bsi_B_Left.Caption = "当前用户：" + pUserInfoMain.UserRBName + ">" + pUserInfoMain.UserRSName + ">" + pUserInfoMain.UserDepName + ">" + pUserInfoMain.Username + ">" + pUserInfoMain.UserPosName;
        }
        #region//--本地化参数调用--//
        private void init()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(TS_Win_Class._xml_SysSetting_Filename); //加载XML文档
            XmlNode xmlNode = xmlDoc.SelectSingleNode("//xml_TS_AllInOne//SQLServer");//加载SQLServer节点
            GetSQLConnString.GetSQLConnString gs = new GetSQLConnString.GetSQLConnString();
            gs.setConnnString(@"Data Source=127.0.0.1.;database=TS_XY_JX_ICC_Data;uid=sa;pwd=sa;Pooling=false;persist security info=True;workstation id=SERVER;packet size=4096");
            //gs.setConnnString(@"server=DESKTOP-T6KQ85L;uid=sa;pwd=198092;database=TS_XY_JX_ICC_Data;Pooling=false;persist security info=True;workstation id=SERVER;packet size=4096");
            //gs.setConnnString(@"Data Source=" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(0).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + "," + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(1).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + ";Initial Catalog=" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(2).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + ";password=" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(4).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + ";Pooling=false;persist security info=True;user id=" + DESEncrypt.Decrypt(xmlNode.ChildNodes.Item(3).InnerText, TS_Win_Class._xml_SysSetting_CompanyName) + ";workstation id=SERVER;packet size=4096");
            GetSQLConnString.GetSQLConnString.SetSQLConnString(gs);
            GetLocalSetting.GetLocalSetting gl = new GetLocalSetting.GetLocalSetting();
            xmlNode = xmlDoc.SelectSingleNode("//xml_TS_AllInOne//LocalSetting//AutoTracNet");//加载启动参数
            if (xmlNode.InnerText == "1")
            {
                gl.set_Net_AutoDetect(true);
            }
            else
            {
                gl.set_Net_AutoDetect(false);
            }
            xmlNode = xmlDoc.SelectSingleNode("//xml_TS_AllInOne//LocalSetting//SkinName");//加载启动参数
            if (xmlNode == null)
            {
            }
            else
            {
                _SkinName = xmlNode.InnerText;
            }

            gl.set_Link_OK(false);
            gl.set_Link_Test_Finish(false);
            GetLocalSetting.GetLocalSetting.SetLocalSetting(gl);
        }
        private void timer_SQL_Test_Tick(object sender, EventArgs e)
        {
            if (GetLocalSetting.GetLocalSetting.getLocalSetting().get_Net_AutoDetect())
            {
                Thread th = new Thread(new ThreadStart(SQL_Test_Link));
                th.Start();
            }
            bsi_B_Left.Caption = "当前用户：" + pUserInfoMain.UserRBName + ">" + pUserInfoMain.UserRSName + ">" + pUserInfoMain.UserDepName + ">" + pUserInfoMain.Username + ">" + pUserInfoMain.UserPosName;
        }
        private void SQL_Test_Link()
        {
            SQL_Test_Link(bsi_B_Right, bei_Sql_Test);
        }
        private void SQL_Link()
        {
            SQL_Link(bsi_B_Right);
        }
        private void SQL_Link(BarStaticItem tl)
        {
            SqlConnection conn = new SqlConnection(TS_Win_Class.GetSQlConnStr());
            SqlCommand cmd = new SqlCommand("select name from sys.databases", conn);
            try
            {
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                }
                GetLocalSetting.GetLocalSetting gl = new GetLocalSetting.GetLocalSetting();
                gl.set_Link_OK(true);
                gl.set_Link_Test_Finish(true);
                GetLocalSetting.GetLocalSetting.SetLocalSetting(gl);
                tl.Caption = "服务器连接成功！";
            }
            catch (Exception ex)
            {
                tl.Caption = "服务器连接错误！";
                GetLocalSetting.GetLocalSetting gl = new GetLocalSetting.GetLocalSetting();
                gl.set_Link_OK(false);
                gl.set_Link_Test_Finish(true);
                GetLocalSetting.GetLocalSetting.SetLocalSetting(gl);
            }
            finally
            {
                conn.Close();
                GetLocalSetting.GetLocalSetting gl = new GetLocalSetting.GetLocalSetting();
                gl.set_Link_Test_Finish(true);
                GetLocalSetting.GetLocalSetting.SetLocalSetting(gl);
            }
        }
        private void SQL_Test_Link(BarStaticItem tl, BarEditItem tp)
        {
            Thread tha = new Thread(new ThreadStart(SQL_Link));
            tha.Start();
            tl.Caption = "测试数据库连接";
            int i = 0;
            while (!GetLocalSetting.GetLocalSetting.getLocalSetting().get_Link_Test_Finish())
            {
                if (i == 99)
                {
                    i = 0;
                }
                if (i % 10 == 0)
                {
                    if (i % 20 == 0)
                    {
                        tl.ImageIndex = 103;
                    }
                    else
                    {
                        tl.ImageIndex = 104;
                    }
                }
                Application.DoEvents();
                //tp.EditValue = i;
                System.Threading.Thread.Sleep(100);
                i++;
            }
            if (GetLocalSetting.GetLocalSetting.getLocalSetting().get_Link_OK())
            {
                tl.ImageIndex = 103;
                tl.Caption = "数据库在线";
            }
            else
            {
                tl.ImageIndex = 104;
                tl.Caption = "数据库离线";
            }
            GetLocalSetting.GetLocalSetting gl = new GetLocalSetting.GetLocalSetting();
            gl.set_Link_Test_Finish(false);
            GetLocalSetting.GetLocalSetting.SetLocalSetting(gl);
        }
        #endregion
        #region//--系统菜单--//
        #region//--系统功能--//
        //退出系统
        private void rp_Sys_Exit_ItemClick(object sender, ItemClickEventArgs e)
        {
            Close();
        }
        //运行参数设置
        private void rp_Sys_BaseSet_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "SystemSettingForm";
            if (htActionItem[item] != null)
            {
                try
                {
                    ((SysSetting.SystemSettingForm)htActionItem[item]).Focus();
                    ((SysSetting.SystemSettingForm)htActionItem[item]).ShowDialog();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                SysSetting.SystemSettingForm SystemSettingForm = new SysSetting.SystemSettingForm();
                SystemSettingForm.StartPosition = FormStartPosition.CenterScreen;
                htActionItem.Add(item, SystemSettingForm);
                SystemSettingForm.Show();
            }
        }
        //在线升级
        private void rp_Sys_Update_ItemClick(object sender, ItemClickEventArgs e)
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = "AutoUpdate.exe";
            process.StartInfo.CreateNoWindow = true;
            process.Start();
            if (process.HasExited)
            { MessageBox.Show("complete"); }
        }
        //切换账户
        private void rp_Sys_Login_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.Visible = false;
            foreach (Form _fm in this.MdiChildren)
            {
                _fm.Close();
            }
            LoginForm login = new LoginForm();

            login.Visible = false;
            if (login.ShowDialog() == DialogResult.Cancel)
            {
                this.Visible = true;
            }
            else
            {
                this.Visible = true;
            }
            login.Close();
            bsi_B_Left.Caption = "当前用户：" + pUserInfoMain.UserRBName + ">" + pUserInfoMain.UserRSName + ">" + pUserInfoMain.UserDepName + ">" + pUserInfoMain.Username + ">" + pUserInfoMain.UserPosName;
        }
        //Web端启动
        private void bti_FirstPage_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Pub_ChartForm_MainForm_FirstPage";
            if (htActionItem[item] != null)
            {
                try
                {
                    ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).Focus();
                    ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).ShowDialog();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                Pub_ChartForm_MainForm_FirstPage _LoadForm = new Pub_ChartForm_MainForm_FirstPage();
                _LoadForm.MdiParent = this;
                _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                htActionItem.Add(item, _LoadForm);
                _LoadForm.Show();
            }
        }
        //修改密码
        private void bti_ChangePassword_ItemClick(object sender, ItemClickEventArgs e)
        {
            Stuff.Tools.Stuff_Tools_Change_Password _LoadForm = new Stuff.Tools.Stuff_Tools_Change_Password();
            _LoadForm.ShowDialog();
        }
        #endregion
        #region//--系统基础设置--//
        //系统底层数据目录管理
        private void rpg_Sys_Base_Tree_Mana_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Sys_Settings_Tree_Level_Main_ManaFrom";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Sys_Settings_Tree_Level_Main_ManaFrom)htActionItem[item]).Focus();
                        ((Sys_Settings_Tree_Level_Main_ManaFrom)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Sys_Settings_Tree_Level_Main_ManaFrom _LoadForm = new Sys_Settings_Tree_Level_Main_ManaFrom();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void rpg_Sys_Base_Org_Stuff_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Stuff_Manage_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Stuff_Manage_ManaForm)htActionItem[item]).Focus();
                        ((Stuff_Manage_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Stuff_Manage_ManaForm _LoadForm = new Stuff_Manage_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void rpg_Sys_Base_Org_Stuff_Dep_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Stuff_Manage_ManaForm_ForDep";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Stuff_Manage_ManaForm_ForDep)htActionItem[item]).Focus();
                        ((Stuff_Manage_ManaForm_ForDep)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Stuff_Manage_ManaForm_ForDep _LoadForm = new Stuff_Manage_ManaForm_ForDep();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void rpg_Sys_Base_Tree_Report_Mana_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Sys_Settings_Tree_Report_Main_ManaFrom";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Sys_Settings_Tree_Report_Main_ManaFrom)htActionItem[item]).Focus();
                        ((Sys_Settings_Tree_Report_Main_ManaFrom)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Sys_Settings_Tree_Report_Main_ManaFrom _LoadForm = new Sys_Settings_Tree_Report_Main_ManaFrom();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--数字地图--//
        private void rpg_Sys_Base_DitMap_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Sys_Setting_Station_WorkPlace";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Sys_Setting_Station_WorkPlace)htActionItem[item]).Focus();
                        ((Sys_Setting_Station_WorkPlace)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Sys_Setting_Station_WorkPlace _LoadForm = new Sys_Setting_Station_WorkPlace();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void rpg_Sys_Base_DitMap_Mana_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "TS_Main_Base_Digital_Map_Map_Edit";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((TS_Main_Base_Digital_Map_Map_Edit)htActionItem[item]).Focus();
                        ((TS_Main_Base_Digital_Map_Map_Edit)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    TS_Main_Base_Digital_Map_Map_Edit _LoadForm = new TS_Main_Base_Digital_Map_Map_Edit();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #endregion
        #region//--基础设置--//
        #region//--机车基础设置--//
        private void rp_Bas_DepSys_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_TrainDepSys_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_TrainDepSys_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_TrainDepSys_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_TrainDepSys_ManaForm _LoadForm = new Locomotive_MainBase_TrainDepSys_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void rp_Bas_TrainList_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_TrainList_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_TrainList_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_TrainList_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_TrainList_ManaForm _LoadForm = new Locomotive_MainBase_TrainList_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--作业流程--//
        private void bbi_Base_Tech_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_WorkFlow_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_WorkFlow_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_WorkFlow_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_WorkFlow_ManaForm _LoadForm = new Locomotive_MainBase_WorkFlow_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #endregion
        #region//--物资物料管理--//
        #region//--基础管理--//
        private void rp_Mati_Base_Code_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Materials_Manage_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Materials_Manage_ManaForm)htActionItem[item]).Focus();
                        ((Materials_Manage_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Materials_Manage_ManaForm _LoadForm = new Materials_Manage_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void rp_Mati_Inter_Code_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Interchange_Manage_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Interchange_Manage_ManaForm)htActionItem[item]).Focus();
                        ((Interchange_Manage_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Interchange_Manage_ManaForm _LoadForm = new Interchange_Manage_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #endregion
        #region//--指挥中心--//
        #region//--整车作业--//
        private void bbi_CCenter_Train_In_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Work_TrainIn_MainForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Work_TrainIn_MainForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Work_TrainIn_MainForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Work_TrainIn_MainForm _LoadForm = new Locomotive_Repair_Work_TrainIn_MainForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    //if(_LoadForm.ShowDialog()==DialogResult.OK)
                    //{
                    //    item = "Locomotive_Repair_Train_Work_Main_ManaForm";
                    //    if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
                    //    {
                    //        if (htActionItem[item] != null)
                    //        {
                    //            try
                    //            {
                    //                ((Locomotive_Repair_Train_Work_Main_ManaForm)htActionItem[item]).Focus();
                    //                ((Locomotive_Repair_Train_Work_Main_ManaForm)htActionItem[item]).InitTrainInList();
                    //                ((Locomotive_Repair_Train_Work_Main_ManaForm)htActionItem[item]).Show();
                    //            }
                    //            catch (Exception)
                    //            {
                    //            }
                    //        }
                    //        else
                    //        {
                    //            Locomotive_Repair_Train_Work_Main_ManaForm Locomotive_Repair_Train_Work_Main_ManaForm = new Locomotive_Repair_Train_Work_Main_ManaForm();
                    //            Locomotive_Repair_Train_Work_Main_ManaForm.MdiParent = this;
                    //            Locomotive_Repair_Train_Work_Main_ManaForm.StartPosition = FormStartPosition.CenterScreen;
                    //            htActionItem.Add(item, Locomotive_Repair_Train_Work_Main_ManaForm);
                    //            Locomotive_Repair_Train_Work_Main_ManaForm.Show();
                    //        }
                    //    }
                    //    else
                    //    {
                    //        MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
                    //    }
                    //}
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void bbi_CCenter_Job_Order_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_WorkPub_Day_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_WorkPub_Day_Pub _LoadForm = new Locomotive_TrainRepair_Work_WorkPub_Day_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_CCenter_Train_OnRepair_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Train_Work_Main_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Train_Work_Main_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Train_Work_Main_ManaForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Train_Work_Main_ManaForm _LoadForm = new Locomotive_Repair_Train_Work_Main_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_CCenter_Train_DigitalMap_ItemClick(object sender, ItemClickEventArgs e)
        {
            TS_XY_Train_Repaire.Locomotive.WPF.Locomotive_WPF_Load_Main _LoadForm = new Locomotive.WPF.Locomotive_WPF_Load_Main();
            _LoadForm.ShowDialog();
        }

        private void rpg_CCenter_Fittings_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_Fittings_Simple_AllList_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_Fittings_Simple_AllList_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_Fittings_Simple_AllList_ManaForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_Fittings_Simple_AllList_ManaForm _LoadForm = new Locomotive_MainBase_Fittings_Simple_AllList_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--转向架作业--//
        #endregion
        #region//--电器作业--//
        #endregion
        #endregion
        #region//--总成库--//
        #region//--调度作业--//

        private void bbi_Assembly_Job_Order_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_WorkPub_Steps_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_WorkPub_Steps_Pub _LoadForm = new Locomotive_TrainRepair_Work_WorkPub_Steps_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Assembly_Train_OnRepair_ItemClick(object sender, ItemClickEventArgs e)
        {

        }

        private void bbi_Assembly_DigiMap_ItemClick(object sender, ItemClickEventArgs e)
        {

        }
        #endregion
        #region//--班组作业--//
        private void rpg_Assembly_Gang_Job_Order_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_WorkPub_Group_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_WorkPub_Group_Pub _LoadForm = new Locomotive_TrainRepair_Work_WorkPub_Group_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void rpg_Assembly_Gang_DataFinish_0_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_DataComplete_PersonWork_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_DataComplete_PersonWork_Form _LoadForm = new Locomotive_TrainRepair_Work_DataComplete_PersonWork_Form();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void rpg_Assembly_Gang_DataFinish_1_ItemClick(object sender, ItemClickEventArgs e)
        {

        }

        private void rpg_Assembly_Gang_DataFinish_Record_ItemClick(object sender, ItemClickEventArgs e)
        {

        }
        #endregion

        #endregion

        #region//--转向架--//
        #region//--基础管理--//
        private void bbi_Bodie_Base_Info_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_Fittings_Simple_Info_Bodie_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_Fittings_Simple_Info_Bodie_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_Fittings_Simple_Info_Bodie_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_Fittings_Simple_Info_Bodie_ManaForm _LoadForm = new Locomotive_MainBase_Fittings_Simple_Info_Bodie_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--上下车配件信息--//
        private void bbi_Bogie_InstallRemove_Info_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm _LoadForm = new Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        private void bbi_Bogie_WorkIn_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Work_BodieIn_MainForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Work_BodieIn_MainForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Work_BodieIn_MainForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Work_BodieIn_MainForm _LoadForm = new Locomotive_Repair_Work_BodieIn_MainForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void bbi_Bogie_WorkMain_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Bodie_Work_Main_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Bodie_Work_Main_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Bodie_Work_Main_ManaForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Bodie_Work_Main_ManaForm _LoadForm = new Locomotive_Repair_Bodie_Work_Main_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Bogie_WorkPub_Day_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_BodieRepair_Work_WorkPub_Day_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_BodieRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Focus();
                        ((Locomotive_BodieRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_BodieRepair_Work_WorkPub_Day_Pub _LoadForm = new Locomotive_BodieRepair_Work_WorkPub_Day_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Bogie_WorkPub_Steps_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_BodieRepair_Work_WorkPub_Steps_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_BodieRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Focus();
                        ((Locomotive_BodieRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_BodieRepair_Work_WorkPub_Steps_Pub _LoadForm = new Locomotive_BodieRepair_Work_WorkPub_Steps_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Bogie_WorkPub_Group_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_BodieRepair_Work_WorkPub_Group_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_BodieRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Focus();
                        ((Locomotive_BodieRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_BodieRepair_Work_WorkPub_Group_Pub _LoadForm = new Locomotive_BodieRepair_Work_WorkPub_Group_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Bogie_WorkPub_DataComplet_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_BodieRepair_Work_DataComplete_PersonWork_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_BodieRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Focus();
                        ((Locomotive_BodieRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_BodieRepair_Work_DataComplete_PersonWork_Form _LoadForm = new Locomotive_BodieRepair_Work_DataComplete_PersonWork_Form();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        #region//--电器--//
        #region//--基础管理--//
        private void bbi_Elect_Base_Info_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_MainBase_Fittings_Simple_Info_Electric_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_MainBase_Fittings_Simple_Info_Electric_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_MainBase_Fittings_Simple_Info_Electric_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_MainBase_Fittings_Simple_Info_Electric_ManaForm _LoadForm = new Locomotive_MainBase_Fittings_Simple_Info_Electric_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--零部件上下车信息--//

        private void bbi_Elect_INstallRemove_Info_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm _LoadForm = new Locomotive_TrainRepair_Work_Fittings_UpDownTrai_Info_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        private void bbi_Elect_WorkIn_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Work_ElectricIn_MainForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Work_ElectricIn_MainForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Work_ElectricIn_MainForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Work_ElectricIn_MainForm _LoadForm = new Locomotive_Repair_Work_ElectricIn_MainForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Elect_WorkMain_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Repair_Electric_Work_Main_ManaForm";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Repair_Electric_Work_Main_ManaForm)htActionItem[item]).Focus();
                        ((Locomotive_Repair_Electric_Work_Main_ManaForm)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Repair_Electric_Work_Main_ManaForm _LoadForm = new Locomotive_Repair_Electric_Work_Main_ManaForm();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Elect_WorkPub_Day_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_ElectricRepair_Work_WorkPub_Day_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_ElectricRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Focus();
                        ((Locomotive_ElectricRepair_Work_WorkPub_Day_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_ElectricRepair_Work_WorkPub_Day_Pub _LoadForm = new Locomotive_ElectricRepair_Work_WorkPub_Day_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Elect_WorkPub_Steps_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_ElectricRepair_Work_WorkPub_Steps_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_ElectricRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Focus();
                        ((Locomotive_ElectricRepair_Work_WorkPub_Steps_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_ElectricRepair_Work_WorkPub_Steps_Pub _LoadForm = new Locomotive_ElectricRepair_Work_WorkPub_Steps_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Elect_WorkPub_Group_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_ElectricRepair_Work_WorkPub_Group_Pub";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_ElectricRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Focus();
                        ((Locomotive_ElectricRepair_Work_WorkPub_Group_Pub)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_ElectricRepair_Work_WorkPub_Group_Pub _LoadForm = new Locomotive_ElectricRepair_Work_WorkPub_Group_Pub();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_Elect_WorkPub_DataComplet_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_ElectricRepair_Work_DataComplete_PersonWork_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_ElectricRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Focus();
                        ((Locomotive_ElectricRepair_Work_DataComplete_PersonWork_Form)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_ElectricRepair_Work_DataComplete_PersonWork_Form _LoadForm = new Locomotive_ElectricRepair_Work_DataComplete_PersonWork_Form();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        #region//--技术管理--//
        #region//--检修计划--//
        private void bbi_TechMana_Plane_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Plane_YearPlane";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Plane_YearPlane)htActionItem[item]).Focus();
                        ((Locomotive_Plane_YearPlane)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Plane_YearPlane _LoadForm = new Locomotive_Plane_YearPlane();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_TechMana_Plane_Schedule_Month_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Locomotive_Plan_Schedule_Month";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Locomotive_Plan_Schedule_Month)htActionItem[item]).Focus();
                        ((Locomotive_Plan_Schedule_Month)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Locomotive_Plan_Schedule_Month _LoadForm = new Locomotive_Plan_Schedule_Month();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion
        #region//--技术资料管理--//
        private void bbi_TechMana_Doc_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "DocMana_jishu_ManaFrom";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((DocMana_jishu_ManaFrom)htActionItem[item]).Focus();
                        ((DocMana_jishu_ManaFrom)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    DocMana_jishu_ManaFrom _LoadForm = new DocMana_jishu_ManaFrom();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        #endregion

        #region//--质量管理--//
        #endregion

        private void Sys_Test_ItemClick(object sender, ItemClickEventArgs e)
        {
            TS_XY_Train_Repaire.Temp.XtraForm1 _uc = new Temp.XtraForm1();
            _uc.ShowDialog();
        }
        #region//--资料管理--//
        #region//--技术资料管理--//
        private void bbi_Pub_Doc_Main_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "DocMana_jishu_ManaFrom";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((DocMana_jishu_ManaFrom)htActionItem[item]).Focus();
                        ((DocMana_jishu_ManaFrom)htActionItem[item]).Show();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    DocMana_jishu_ManaFrom _LoadForm = new DocMana_jishu_ManaFrom();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        private void bbi_Pub_Doc_Query_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "DocMana_Check_ManaFrom";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((DocMana_Check_ManaFrom)htActionItem[item]).Focus();
                        ((DocMana_Check_ManaFrom)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    DocMana_Check_ManaFrom _LoadForm = new DocMana_Check_ManaFrom();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }
        #endregion

        #endregion

        private void timer1_Tick(object sender, EventArgs e)
        {
            //MessageBox.Show("select count(*) as f_count from TS_S_T_P_Voice_Announce where f_del=0 and f_stuffid<0 and ((f_type=0 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.GuId + ") or (f_type=1 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.UserPosID + ") or (f_type=2 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.UserDepIndex + "))");
            string _Count = TS_Win_Class.GetSQlFieldValue("select count(*) as f_count from TS_S_T_P_Voice_Announce where f_del=0 and f_stuffid<0 and ((f_type=0 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.GuId + ") or (f_type=1 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.UserPosID + ") or (f_type=2 and f_funcid=" + TS_Win_Locomotive_MainForm.pUserInfoMain.UserDepIndex + "))", "f_count");
            bbi_Buttom_Meesage.Caption = "消息待签收（" + _Count + "条）";
        }

        private void bbi_Buttom_Meesage_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Pub_ChartForm_MainForm_FirstPage";
            if (htActionItem[item] != null)
            {
                try
                {
                    ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).Focus();
                    ((Pub_ChartForm_MainForm_FirstPage)htActionItem[item]).Show();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                Pub_ChartForm_MainForm_FirstPage _LoadForm = new Pub_ChartForm_MainForm_FirstPage();
                _LoadForm.MdiParent = this;
                _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                htActionItem.Add(item, _LoadForm);
                _LoadForm.Show();
            }
        }

        #region//--工具系统--//
        private void bbi_Tool_Input_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_ToolInput_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_ToolInput_Form)htActionItem[item]).Focus();
                        ((Tool_System_ToolInput_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_ToolInput_Form _LoadForm = new Tool_System_ToolInput_Form();
                    _LoadForm.MdiParent = this;
                    _LoadForm.StartPosition = FormStartPosition.CenterScreen;
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_ToolType_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_ToolType_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_ToolType_Form)htActionItem[item]).Focus();
                        ((Tool_System_ToolType_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_ToolType_Form _LoadForm = new Tool_System_ToolType_Form
                    {
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_ToolPos_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_StoreHouse_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_StoreHouse_Form)htActionItem[item]).Focus();
                        ((Tool_System_StoreHouse_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_StoreHouse_Form _LoadForm = new Tool_System_StoreHouse_Form
                    {
                        //IOrderType = 0,
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void btn_toolbox_ItemClick(object sender, ItemClickEventArgs e)
        {
            //string item = "Tool_System_ToolBoxEdit_Form";
            //if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            //{
            //    if (htActionItem[item] != null)
            //    {
            //        try
            //        {
            //            ((Tool_System_ToolBoxEdit_Form)htActionItem[item]).Focus();
            //            ((Tool_System_ToolBoxEdit_Form)htActionItem[item]).ShowDialog();
            //        }
            //        catch (Exception)
            //        {
            //        }
            //    }
            //    else
            //    {
            //        Tool_System_ToolBoxEdit_Form _LoadForm = new Tool_System_ToolBoxEdit_Form
            //        {
            //            MdiParent = this,
            //            StartPosition = FormStartPosition.CenterScreen
            //        };
            //        htActionItem.Add(item, _LoadForm);
            //        _LoadForm.Show();
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            //}

            string item = "Tool_System_ToolBox_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_ToolBox_Form)htActionItem[item]).Focus();
                        ((Tool_System_ToolBox_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_ToolBox_Form _LoadForm = new Tool_System_ToolBox_Form
                    {
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_apply_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_OrderList_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_OrderList_Form)htActionItem[item]).Focus();
                        ((Tool_System_OrderList_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_OrderList_Form _LoadForm = new Tool_System_OrderList_Form
                    {
                        IOrderType = 0,
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_send_ItemClick(object sender, ItemClickEventArgs e)
        {
            //string item = "Form1";
            //if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            //{
            //    if (htActionItem[item] != null)
            //    {
            //        try
            //        {
            //            ((Form1)htActionItem[item]).Focus();
            //            ((Form1)htActionItem[item]).ShowDialog();
            //        }
            //        catch (Exception)
            //        {
            //        }
            //    }
            //    else
            //    {
            //        Form1 _LoadForm = new Form1
            //        {
            //            MdiParent = this,
            //            StartPosition = FormStartPosition.CenterScreen
            //        };
            //        htActionItem.Add(item, _LoadForm);
            //        _LoadForm.Show();
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            //}
        }

        private void bbi_retun_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_OrderList_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_OrderList_Form)htActionItem[item]).Focus();
                        ((Tool_System_OrderList_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_OrderList_Form _LoadForm = new Tool_System_OrderList_Form
                    {
                        IOrderType = 0,
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_finish_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_StoreHouse_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_StoreHouse_Form)htActionItem[item]).Focus();
                        ((Tool_System_StoreHouse_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_StoreHouse_Form _LoadForm = new Tool_System_StoreHouse_Form
                    {
                        //IOrderType = 0,
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_repair_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_RepairList_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_RepairList_Form)htActionItem[item]).Focus();
                        ((Tool_System_RepairList_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_RepairList_Form _LoadForm = new Tool_System_RepairList_Form
                    {
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        private void bbi_group_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = "Tool_System_GroupList_Form";
            if (TS_Win_Class.GetAuthorityInXmlByString(item, pUserInfoMain.UserDataRankID))
            {
                if (htActionItem[item] != null)
                {
                    try
                    {
                        ((Tool_System_GroupList_Form)htActionItem[item]).Focus();
                        ((Tool_System_GroupList_Form)htActionItem[item]).ShowDialog();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Tool_System_GroupList_Form _LoadForm = new Tool_System_GroupList_Form
                    {
                        MdiParent = this,
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    htActionItem.Add(item, _LoadForm);
                    _LoadForm.Show();
                }
            }
            else
            {
                MessageBox.Show("你没有该功能操作权限，或者该控件非法，请联系系统管理员！");
            }
        }

        #endregion


    }
}